import axios from 'axios'

// 登录
export const login = (username, password) => axios.post('/login/admin', {
	username,
	password
})
// 获取管理员列表
export const getAdminList = () => axios.get('/info/getAdminList')
// 添加管理员
export const addAdmin = (username, password) => axios.post('/register/admin', {
	username,
	password
})
// 获取用户列表
export const getUserList = () => axios.get('/info/getUserList')
// 删除管理员
export const deleteAdmin = (id) => axios.get(`/info/deleteAdmin?id=${id}`)
// 删除用户
export const deleteUser = (id) => axios.get(`/info/deleteUser?id=${id}`)
// 获取音乐类型
export const getMusicType = () => axios.get('/music/getMusicType')
// 修改用户信息
export const editUserInfo = (form) => axios.post('/info/editUserInfo', form)
// 添加音乐类型
export const addMusicType = (name, create_time) => axios.post('/music/addMusicType', {
	name,
	create_time
})
// 删除音乐类型
export const deleteMusicType = (id) => axios.get(`/music/deleteMusicType?id=${id}`)
// 修改音乐类型
export const editMusicType = (id, name) => axios.post('/music/editMusicType', {
	id,
	name
})
// 获取music
export const getMusicList = () => axios.get('/music/getMusic');
// 通过musictypeid获取music
export const getMusicListByMusicTypeId = (id) => axios.get(`/music/getMusicByMusicTypeId?musictypeid=${id}`);
// 删除music
export const deleteMusic = (id) => axios.get(`/music/deleteMusic?id=${id}`)
// 通过musictypeid获取musictype
export const getMusicTypeByMusicTypeId = (id) => axios.get(`/music/getMusicTypeById?id=${id}`)
// 修改music
export const editMusic = (form) => axios.post('/music/editMusic', form)
// 获取singerType
export const getSingerType = () => axios.get('/singer/getSingerType')
// 获取singer
export const getSinger = () => axios.get('/singer/getSinger')
// 获取评论
// type(0歌曲 1歌单 2mv) musicid gedanid mvid
// 举例
// let res = await getComment(0, 'musicid', id);
export const getComment = (type, ids, id) => axios.get(`/comment/get?type=${type}&${ids}=${id}`);
// 删除评论
export const deleteComment = (id) => axios.get(`/comment/delete?id=${id}`);
// 获取mv
export const getMVList = () => axios.get('/mv/getMv');
// 添加音乐
export const addMusic = (form) => axios.post('/music/addMusic', form);
// 删除mv
export const deleteMV = (id) => axios.get(`/mv/deleteMv?id=${id}`)
// 修改mv
export const editMV = (form) => axios.post('/mv/editMv', form)
// 添加mv
export const addMV = (form) => axios.post('/mv/addMv', form)
// 添加newstype
export const addNewsType = (name, create_time) => axios.post('/news/addNewsType', {
	name,
	create_time
})
// 获取newsType
export const getNewsType = () => axios.get('/news/getNewsType')
// 删除newstype
export const deleteNewsType = (id) => axios.get(`/news/deleteNewsType?id=${id}`)
// 修改newstype
export const editNewsType = (id, name) => axios.post('/news/editNewsType', {
	id,
	name
})
// 获取news
export const getNews = () => axios.get('/news/getNews');
// 根据newstypeid获取news
export const getNewsByNewsTypeId = (id) => axios.get(`/news/getNewsByNewsTypeId?newstypeid=${id}`)
// 根据newstypeid获取newstype
export const getNewsTypeById = (id) => axios.get(`/news/getNewsTypeById?id=${id}`)
// 修改news 有content
export const editNewsWithContent = (id, content) => axios.post('/news/editNewsWithContent', {
	id,
	content
})
// 删除news
export const deleteNews = (id) => axios.get(`/news/deleteNews?id=${id}`)
// 修改news 没有content 
export const editNewsNoContent = (form) => axios.post('/news/editNewsNoContent', form)
// 添加news
export const addNews = (form) => axios.post('/news/addNews', form)
// 添加歌单tag
export const addGedanTag = (name, create_time) => axios.post('/gedan/addTag', {
	name,
	create_time
})
// 获取歌单tag
export const getGedanTag = () => axios.get('/gedan/getTag')
// 删除歌单tag
export const deleteGedanTag = (id) => axios.get(`/gedan/deleteTag?id=${id}`)
// 编辑歌单tag
export const editGedanTag = (id, name) => axios.post('/gedan/editTag', {
	id,
	name
})
// 通过gedantagid获取gedan
export const getGedanByGedenTagId = (id) => axios.get(`/gedan/getGedanByGedanTagId?gedantagid=${id}`)
// 获取gedan
export const getGedan = () => axios.get('/gedan/get')
// 通过id获取gedantag
export const getGedanTagById = (id) => axios.get(`/gedan/getTagById?id=${id}`)
// 删除歌单
export const deleteGedan = (id) => axios.get(`/gedan/delete?id=${id}`)
// 获取music通过musicid
export const getMusicById = (id) => axios.get(`/music/getMusicById?id=${id}`)
// 编辑歌单
export const editGedan = (form) => axios.post('/gedan/edit', form)
// 获取数据
export const getCount = () => axios.get('/data/getCounts')
// 添加歌手type
export const addSingerType = (name, create_time) => axios.post('/singer/addSingerType', {
	name,
	create_time
})
// 删除singertype
export const deleteSingerType = (id) => axios.get(`/singer/deleteSingerType?id=${id}`)
// 修改singertype
export const editSingerType = (id, name) => axios.post('/singer/editSingerType', {
	id,
	name
})
// 通过singertypeid获取singer
export const getSingerBySingerTypeId = (id) => axios.get(`/singer/getSingerBySingerTypeId?singertypeid=${id}`)
// 通过id获取singertype
export const getSingerTypeById = (id) => axios.get(`/singer/getSingerTypeById?id=${id}`)
// 删除singer
export const deleteSinger = (id) => axios.get(`/singer/deleteSinger?id=${id}`)
// 通过singerid获取mv
export const getMvBySingerId = (id) => axios.get(`/mv/getMvBySingerId?singerid=${id}`)
// 通过singerid获取music
export const getMusicBySingerId = (id) => axios.get(`/music/getMusicBySingerId?singerid=${id}`)
// 编辑singer
export const editSinger = (form) => axios.post('/singer/editSinger', form)
// 添加singer
export const addSinger = (form)=>axios.post('/singer/addSinger',form);